// by Xeno
private ["_vehicle"];
#include "x_setup.sqf"
#include "x_macros.sqf"

#define __Poss _poss = x_sm_pos select 0;
#define __PossAndOther _poss = x_sm_pos select 0;_pos_other = x_sm_pos select 1;

x_sm_pos = [[1711.8701,8231.415,0], [1686.114,8279.6621,0]]; // Officer, Rog, second array = position Shilka
x_sm_type = "normal"; // "convoy"

#ifdef __SMMISSIONS_MARKER__
if (true) exitWith {};
#endif

if (X_Client) then {
	d_current_mission_text = "A high enemy officer arrives today in Ashlake Resort. He is responsible for the death of many civilians. Eliminate him!";
	d_current_mission_resolved_text = "The enemy officer is dead. Good job.";
};

if (isServer) then {
	_officer = switch (d_enemy_side) do {
		case "EAST": {"RU_Commander"};
		case "WEST": {"USMC_Soldier_Officer"};
		case "GUER": {"GUE_Commander"};
	};
	__PossAndOther
	["shilka", 1, "brdm", 1, "uaz_grenade", 1, _pos_other,1,0,false] spawn XCreateArmor;
	sleep 2.123;
	_fortress = "Land_Fort_Watchtower" createVehicle _poss;
	_fortress setDir -133.325;
	__AddToExtraVec(_fortress)
	sleep 2.123;
	__GetEGrp(_ogroup)
	_sm_vehicle = _ogroup createUnit [_officer, _poss, [], 0, "FORM"];
	[_sm_vehicle] join _ogroup;
	allunits_add set [count allunits_add, _sm_vehicle];
	#ifndef __TT__
	_sm_vehicle addEventHandler ["killed", {_this call XKilledSMTargetNormal}];
	#endif
	#ifdef __TT__
	_sm_vehicle addEventHandler ["killed", {_this call XKilledSMTargetTT}];
	#endif
	sleep 2.123;
	//_bpos = _fortress buildingPos 0;
	_bpos = position _fortress;
	//player sideChat format ["_bpos: %1", _bpos];
	_sm_vehicle setPos _bpos;
	sleep 2.123;
	["specops", 1, "basic", 2, _poss, 100,true] spawn XCreateInf;
	sleep 2.123;
	_leadero = leader _ogroup;
	_leadero setRank "COLONEL";
	_ogroup allowFleeing 0;
	_ogroup setbehaviour "AWARE";
	_leadero disableAI "MOVE";
};

if (true) exitWith {};